/**
 * 
 */
package com.mwaysolutions.ocm.impl;

import javax.jcr.Item;
import javax.jcr.RepositoryException;

class IsSameItemEqualsWrapper {
	private final Item item;

	public IsSameItemEqualsWrapper(final Item item) {
		this.item = item;
	}

	@Override
	public boolean equals(final Object obj) {
		try {
			return item.isSame(((IsSameItemEqualsWrapper) obj).getItem());
		} catch (final RepositoryException e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	public int hashCode() {
		try {
			return item.getPath().hashCode();
		} catch (final RepositoryException e) {
			throw new RuntimeException(e);
		}
	}

	public Item getItem() {
		return item;
	}
}